package com.gitee.solon.admin.controller;

import com.gitee.solon.admin.service.AccountService;
import com.gitee.solon.admin.service.UserService;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.annotation.Param;

@Controller
public class DemoController {

    @Inject
    AccountService accountService;

    @Inject
    UserService userService;

    @Mapping("/test1")
    public String test1(@Param(defaultValue = "world") String name) {
        accountService.selectAll().stream().forEach(System.out::println);
        userService.selectAll().stream().forEach(System.out::println);
        return String.format("Hello %s!", name);
    }

    @Mapping("/test2")
    public String hello(@Param(defaultValue = "world") String name) {
        accountService.getAccountList().stream().forEach(System.out::println);
        userService.getUserList().stream().forEach(System.out::println);
        return String.format("Hello %s!", name);
    }
}